package com.kws.payment.dao;

/**
 * <b>CloseBody</b>
 *
 * @description: CloseBody <br>
 * @date: 2024/11/27 18:12 <br>
 * @author: lhm <br>
 * @version: 1.0 <br>
 */
public class CloseBody {
    //消息ID
    private String msgId;
    //报文请求时间，格式yyyy-MM-ddHH:mm:ss
    private String requestTimestamp;
    //请求系统预留字段
    private String srcReserve;
    //商户号
    private String mid;
    //终端号
    private String tid;
    //业务类型
    private String instMid;
    //商户订单号
    private String merOrderId;

    //订单金额
    private String totalAmount;

    public String getMsgId() {
        return msgId;
    }

    public void setMsgId(String msgId) {
        this.msgId = msgId;
    }

    public String getRequestTimestamp() {
        return requestTimestamp;
    }

    public void setRequestTimestamp(String requestTimestamp) {
        this.requestTimestamp = requestTimestamp;
    }

    public String getSrcReserve() {
        return srcReserve;
    }

    public void setSrcReserve(String srcReserve) {
        this.srcReserve = srcReserve;
    }

    public String getMid() {
        return mid;
    }

    public void setMid(String mid) {
        this.mid = mid;
    }

    public String getTid() {
        return tid;
    }

    public void setTid(String tid) {
        this.tid = tid;
    }

    public String getInstMid() {
        return instMid;
    }

    public void setInstMid(String instMid) {
        this.instMid = instMid;
    }

    public String getMerOrderId() {
        return merOrderId;
    }

    public void setMerOrderId(String merOrderId) {
        this.merOrderId = merOrderId;
    }

    public String getTotalAmount() {
        return totalAmount;
    }

    public void setTotalAmount(String totalAmount) {
        this.totalAmount = totalAmount;
    }

    String toJson(){
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (this.msgId != null) sb.append("\"msgId\":\"" + this.msgId + "\",");
        if (this.requestTimestamp != null) sb.append("\"requestTimestamp\":\"" + this.requestTimestamp + "\",");
        if (this.srcReserve != null) sb.append("\"srcReserve\":\"" + this.srcReserve + "\",");
        if (this.mid != null) sb.append("\"mid\":\"" + this.mid + "\",");
        if (this.tid != null) sb.append("\"tid\":\"" + this.tid + "\",");
        if (this.instMid != null) sb.append("\"instMid\":\"" + this.instMid + "\",");
        if (this.merOrderId != null) sb.append("\"merOrderId\":\"" + this.merOrderId + "\",");
        if (sb.charAt(sb.length() - 1) == ',')
            sb.deleteCharAt(sb.length() - 1);
        sb.append("}");
        return sb.toString();
    }

    public String toString(){
        return this.toJson();
    }
}
